//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.lsk.weixin.SdkRewrite.shakearound;

import com.jfinal.plugin.redis.Cache;
import com.jfinal.plugin.redis.Redis;
import com.jfinal.weixin.sdk.api.ApiResult;
import com.jfinal.weixin.sdk.utils.HttpUtils;
import com.jfinal.wxaapp.api.WxaTemplate;
import com.lsk.bean.WxaBean;

public class WxaTemplateApiRewrite {
    Cache cache= Redis.use();
    private static String sendApiUrl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=";

    public WxaTemplateApiRewrite() {
    }

    public ApiResult send(String jsonStr,String appId) {
        String key="wxaToken"+appId;
        String accessToke=cache.get(key).toString();
        String jsonResult = HttpUtils.post(sendApiUrl +accessToke , jsonStr);
        return new ApiResult(jsonResult);
    }

    public ApiResult send(WxaTemplate template,String appId) {
        return this.send(template.build(),appId);
    }
}
